package com.controller;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import oracle.jdbc.pool.OracleDataSource;

public class PengendaliPeriksaSuratDokumen {

    public static void confirmTabelSurat(String a,String b) throws SQLException {
        String jdbcUrl = "jdbc:oracle:thin:@localhost:1521:xe";
        String userid = "PROJECT-PBO2";
        String password = "acong";
        Connection conn;
        try {
            OracleDataSource ds;
            ds = new OracleDataSource();
            ds.setURL(jdbcUrl);
            conn = ds.getConnection(userid, password);
            Statement statement=conn.createStatement();
            System.out.println("Koneksi is OK");
            System.out.println(a);
            System.out.println(b);
            String sql = " update surat set status = 'OK' where tgl_masuk between '"+a+"' and  '"+b+"'";
            statement.executeUpdate(sql);
            conn.close();
        } catch (SQLException e) {
            System.out.println("error :" + e.getMessage());
        }
    }
    public static void confirmTabelDokumen(String a,String b) throws SQLException {
        String jdbcUrl = "jdbc:oracle:thin:@localhost:1521:xe";
        String userid = "PROJECT-PBO2";
        String password = "acong";
        Connection conn;
        try {
            OracleDataSource ds;
            ds = new OracleDataSource();
            ds.setURL(jdbcUrl);
            conn = ds.getConnection(userid, password);
            Statement statement=conn.createStatement();
            System.out.println("Koneksi is OK");
            System.out.println(a);
            System.out.println(b);
            String sql = " update dokumen set status = 'OK' where tgl_masuk between '"+a+"' and  '"+b+"'";
            statement.executeUpdate(sql);
            conn.close();
        } catch (SQLException e) {
            System.out.println("error :" + e.getMessage());
        }
    }
}
